<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>修改密码</title>
<link rel="stylesheet" href="../public/layui/css/layui.css" media="all">
<script src="../public/layui/layui.js" charset="utf-8"></script>

<style type="text/css">

</style>

</head>
<body>
<%if(session.getAttribute("user")==null){ %>
    <script>
		window.top.location.replace("../login.jsp");
	</script>
<%}%>
<div>
	<fieldset class="layui-elem-field layui-field-title" style="margin-top: 30px;">
		<legend><h2>修改密码</h2></legend>
	</fieldset>
	<form action="../OrdinaryEmployeesServlet?button=3" method="post">
		<div class="layui-form-item">
	        <div class="layui-input-block">
	            <input type="password" id="password" name="password" required="required" placeholder="请输入新密码" class="layui-input" style="width:500px;" onclick="init()" onblur="check()" />
	            <span id="span1"></span>
	        </div>
	    </div>
	    <div class="layui-form-item">
	        <div class="layui-input-block">
	            <input type="password" id="password2" name="password2" placeholder="请再次确认新密码" class="layui-input" style="width:500px;" onclick="init()" onblur="check()" />
	        	<span id="span2" style="color:red;"></span>
	        </div>
	    </div>
	    <div class="layui-form-item">
	<!--         <label class="layui-form-label required">所在部门和职位：</label> -->
	        <div class="layui-input-block">
<!-- 	            <input type="submit" id="submit" name="submit" class="layui-btn layui-btn-primary layui-border-blue" value="确认修改" /> -->
	            <button type="submit" id="submit" name="submit" class="layui-btn layui-btn-disabled" >确认修改</button>
	        </div>
	    </div>
	</form>
</div>
<script type="text/javascript">
function check(){
	var password = document.getElementById("password").value;
	var password2 = document.getElementById("password2").value;
	if(password != password2){
		document.getElementById("span2").innerText="两次密码不同，请检查后再确认";
		document.getElementById("submit").setAttribute("disabled","disabled");
 		document.getElementById("submit").setAttribute("class","layui-btn layui-btn-disabled");
	}
}
function init(){
	document.getElementById("span2").innerText="";
	document.getElementById("submit").removeAttribute("disabled");
	document.getElementById("submit").setAttribute("class","layui-btn layui-btn-primary layui-border-green");
}
</script>
</body>
</html>